//
//  InviteRecordVC.m
//  HengYouCai
//
//  Created by ycgwl on 2017/5/3.
//  Copyright © 2017年 lwj. All rights reserved.
//

#import "InviteRecordVC.h"
#import "InviteRegistedVC.h"
#import "InviteInvestedVC.h"
#import <Masonry/Masonry.h>
#import <SDAutoLayout/SDAutoLayout.h>
#import "HengYouCai-Swift.h"

@interface InviteRecordVC ()

@end

@implementation InviteRecordVC
- (instancetype)init
{
    self = [super init];
    if (self) {
        NSArray *titles = @[@"我的邀请",@"收益记录"];
        InviteRegistedVC *inviteRegisted = [[UIStoryboard storyboardWithName:@"Profile" bundle:nil] instantiateViewControllerWithIdentifier:@"InviteRegistedVCID"];
        InviteInvestedVC *inviteInvested = [[UIStoryboard storyboardWithName:@"Profile" bundle:nil] instantiateViewControllerWithIdentifier:@"InviteInvestedVCID"];
        
        NSArray *vcs = @[inviteRegisted,inviteInvested];
        self.titles = titles;
        self.contents = vcs;
        self.titleH = 40;
        self.intervalH = 0;
        self.bottomHeight = kJcwGetTabbarHeight()-4;
        // YES 的话 就是显示
        self.grayLineIsHid = YES;
    }
    return self;
}
- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.navigationItem.title = @"邀请记录";
    
    UIButton *bottomBtn = [UIButton buttonWithType:UIButtonTypeCustom];

    bottomBtn.backgroundColor = Normal_RedColor;
    [bottomBtn setTitle:@"邀好友，一起赚" forState:UIControlStateNormal];
    [bottomBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    bottomBtn.titleLabel.font = [UIFont systemFontOfSize:15];
    [bottomBtn addTarget:self action:@selector(inviteFrient) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:bottomBtn];

    
    bottomBtn.sd_layout.bottomSpaceToView(self.view, 0).heightIs(kJcwGetTabbarHeight()-4).rightSpaceToView(self.view, 0).leftSpaceToView(self.view, 0);
}

/**
 邀好友，一起赚
 */
- (void)inviteFrient
{

    JCWShareVC * vc = [[JCWShareVC alloc] init];
    vc.modalPresentationStyle = UIModalPresentationOverCurrentContext;
    @weakify(self)
    vc.shareResultHandler = ^(NSString * _Nonnull str) {
        [self_weak_.view showHUDWarnTips:str hideDelay:kHUDHideDelay];
    };
    [self presentViewController:vc animated:YES completion:nil];
}

@end
